import axios from 'axios'

export default class HrEmpService {
    static hrEmpService = null
    requestUrl = 'http://localhost/hrEmps'

    static getInstance() {
        if (this.hrEmpService == null) {
            this.hrEmpService = new HrEmpService()
        }
        return this.hrEmpService
    }

    //查询所有员工
    getEmps() {
        return axios.get(this.requestUrl)
    }

    listByUserIDisNull(){
        return axios.get(`http://localhost/hrEmps/Y`)
    }



    //根据角色查询员工
    getEmpsByRole(role) {
        return axios.get(`${this.requestUrl}/role/${role}`)
    }

    /**
     * 根据当前用户查询对应的员工
     */
    getByCurrentUser() {
        return axios.get(`${this.requestUrl}/current`)
    }
}
